/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.worlds.object;

import net.worlds.WorldsException;
import net.worlds.Main;
import net.worlds.PropChangeHandler;


public class Team extends GameObject{
    public Team() throws WorldsException
    {
        super("Team");
        addPropChangeHandler("Name", new PropChangeHandler()
        {
            @Override
            public void handle(Object oldValue, Object value) throws WorldsException {
                if(oldValue != null && world == world.game.getMainWorld() && getParent() instanceof Teams)
                {
                    world.game.removeTeam(oldValue.toString());
                    world.game.addTeam(Team.this);
                }
            }
        });
    }
}
